<%@ include file="../inc/common.jsp"%>
<!DOCTYPE HTML>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<title>成绩列表</title>
<style>
	.page{margin-top:5px;border-top: 1px solid #DDDDDD;padding: 2px;border-bottom: 1px solid #DDDDDD;font-family: inherit;font-size: 11px;}
	.page a{border:1px solid #DDDDDD;text-align: center;}
	.page a:HOVER{text-decoration: none;font-color: white;}
	.current{background:#23B300;color:white; display: inline-block;height:19px ;width:19px;}
	.num{display: inline-block;height:19px ;width:19px;}
</style>
<body>
<div class="pd-20">
	<div class="text-c">
	</div>
	<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l">
	<table class="table table-border table-bordered table-bg">
		<thead>
			<tr>
				<th scope="col" colspan="12">成绩列表</th>
			</tr>
			<tr class="text-c">
				<th width="300">学号</th>
				<th width="300">学生姓名</th>
				<th width="300">课程编号</th>
				<th width="300">课程名</th>
				<th width="300">分数</th>
				<th width="300">是否及格</th>
				<th width="300">教师编号</th>
				<th width="300">教师姓名</th>
				<th width="300">创建时间</th>
				<th width="300">更新时间</th>
				<th width="300">操作</th>
			</tr>
		</thead>
		<tbody>
			<s:if test="scores.size()!=0">
			<s:iterator value="scores" >
			<tr class="text-c">
				<td>${stuNo}</td>
				<td>${studentName }</td>
				<td>${courseCode}</td>
				<td>${courseName}</td>
				<td>${score}</td>
				<s:if test="score>0">
					<td>及格</td>
				</s:if>
				<s:else>
					<td>未及格</td>
				</s:else>
                <td>${empno}</td>
                <td>${teacherName}</td>
                <td>${createTimeStr}</td>
                <td>${lastAccessStr}</td>
                <td class="td-manage"><a style="text-decoration:none" onClick="member_stop(this,'10001','score_${stuNo}','${id}')" href="javascript:;" title="打分"><i class="Hui-iconfont">&#xe631;</i></a> </td>
			</tr>
			</s:iterator>
				</s:if>
				<s:else>
					<tr class="text-c">
						<td style="text-align: center;" colspan="12">暂无数据!</td>
					</tr>
				</s:else>
		</tbody>
	</table>
</div>
    <script type="text/javascript">

        /*用户-停用*/
        function member_stop(obj,id,scoreId,dataId){
            var score = $("#"+scoreId).val();
            if(score==0)
            {
                layer.alert('分数为0不需要打分!!');
                return;
            }
            if(isNaN(score)||score<1)
            {
                layer.alert('请填写合法的分数!!');
                return;
            }

            layer.confirm('确认更改该学生的成绩?',function(index){


                $.ajax({
                    type: 'POST',
                    url: "/score/fill-score.htm",
                    data:{"id":dataId,"score":score},
                    success:function(data)
                    {
                        if(data=="success")
                        {
                            $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_start(this,id)" href="javascript:;" title="缴费"><i class="Hui-iconfont">&#xe6e1;</i></a>');
                            $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已打分</span>');
                            $(obj).remove();
                            layer.msg('操作成功!',{icon: 6,time:1000});
                        }
                    }
                });
            });
        }

         function member_start(obj,id){
         layer.confirm('确认更改该学生的缴费状态吗？',function(index){
         $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_stop(this,id)" href="javascript:;" title="停用"><i class="Hui-iconfont">&#xe631;</i></a>');
         $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
         $(obj).remove();
         layer.msg('已启用!',{icon: 6,time:1000});
         });
         }
    </script>
</body>
</html>